package com.ruoyi.system.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.ZhuanjiabiandongshenbaoZhuanli;
import com.ruoyi.system.service.IZhuanjiabiandongshenbaoZhuanliService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 专家变动申报_转隶Controller
 * 
 * @author dy
 * @date 2024-05-27
 */
@Controller
@RequestMapping("/system/biandongshenbao_zhuanli")
public class ZhuanjiabiandongshenbaoZhuanliController extends BaseController
{
    private String prefix = "system/biandongshenbao_zhuanli";

    @Autowired
    private IZhuanjiabiandongshenbaoZhuanliService zhuanjiabiandongshenbaoZhuanliService;

    @RequiresPermissions("system:biandongshenbao_zhuanli:view")
    @GetMapping()
    public String biandongshenbao_zhuanli()
    {
        return prefix + "/biandongshenbao_zhuanli";
    }

    /**
     * 查询专家变动申报_转隶列表
     */
    @RequiresPermissions("system:biandongshenbao_zhuanli:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(ZhuanjiabiandongshenbaoZhuanli zhuanjiabiandongshenbaoZhuanli)
    {
        startPage();
        List<ZhuanjiabiandongshenbaoZhuanli> list = zhuanjiabiandongshenbaoZhuanliService.selectZhuanjiabiandongshenbaoZhuanliList(zhuanjiabiandongshenbaoZhuanli);
        return getDataTable(list);
    }

    /**
     * 导出专家变动申报_转隶列表
     */
    @RequiresPermissions("system:biandongshenbao_zhuanli:export")
    @Log(title = "专家变动申报_转隶", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(ZhuanjiabiandongshenbaoZhuanli zhuanjiabiandongshenbaoZhuanli)
    {
        List<ZhuanjiabiandongshenbaoZhuanli> list = zhuanjiabiandongshenbaoZhuanliService.selectZhuanjiabiandongshenbaoZhuanliList(zhuanjiabiandongshenbaoZhuanli);
        ExcelUtil<ZhuanjiabiandongshenbaoZhuanli> util = new ExcelUtil<ZhuanjiabiandongshenbaoZhuanli>(ZhuanjiabiandongshenbaoZhuanli.class);
        return util.exportExcel(list, "专家变动申报_转隶数据");
    }

    /**
     * 新增专家变动申报_转隶
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存专家变动申报_转隶
     */
    @RequiresPermissions("system:biandongshenbao_zhuanli:add")
    @Log(title = "专家变动申报_转隶", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(ZhuanjiabiandongshenbaoZhuanli zhuanjiabiandongshenbaoZhuanli)
    {
        return toAjax(zhuanjiabiandongshenbaoZhuanliService.insertZhuanjiabiandongshenbaoZhuanli(zhuanjiabiandongshenbaoZhuanli));
    }

    /**
     * 修改专家变动申报_转隶
     */
    @RequiresPermissions("system:biandongshenbao_zhuanli:edit")
    @GetMapping("/edit/{shenbaoid}")
    public String edit(@PathVariable("shenbaoid") String shenbaoid, ModelMap mmap)
    {
        ZhuanjiabiandongshenbaoZhuanli zhuanjiabiandongshenbaoZhuanli = zhuanjiabiandongshenbaoZhuanliService.selectZhuanjiabiandongshenbaoZhuanliByShenbaoid(shenbaoid);
        mmap.put("zhuanjiabiandongshenbaoZhuanli", zhuanjiabiandongshenbaoZhuanli);
        return prefix + "/edit";
    }

    /**
     * 修改保存专家变动申报_转隶
     */
    @RequiresPermissions("system:biandongshenbao_zhuanli:edit")
    @Log(title = "专家变动申报_转隶", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(ZhuanjiabiandongshenbaoZhuanli zhuanjiabiandongshenbaoZhuanli)
    {
        return toAjax(zhuanjiabiandongshenbaoZhuanliService.updateZhuanjiabiandongshenbaoZhuanli(zhuanjiabiandongshenbaoZhuanli));
    }

    /**
     * 删除专家变动申报_转隶
     */
    @RequiresPermissions("system:biandongshenbao_zhuanli:remove")
    @Log(title = "专家变动申报_转隶", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(zhuanjiabiandongshenbaoZhuanliService.deleteZhuanjiabiandongshenbaoZhuanliByShenbaoids(ids));
    }
}
